package phoenix.mob_android.test_objects;

import phoenix.core.PhoenixManager;
import phoenix.core.base.extensions.TestBaseMobAndroidExt;

public class LoginTests extends TestBaseMobAndroidExt
{
	public LoginTests(PhoenixManager p_phoenix)
	{
		super(p_phoenix);
	}

	public void loginTest()
	{
		try
		{
			if (manager.isFlirt() || manager.isCL())
			{
				page().mainMenu().openMainMenu().openMyProfile().openSettings();
			}
			if (manager.isWB())
			{
				page().mainMenu().openMainMenu().openSettings();
			}
			page().settingsPage().clickLogoutButton();
			page().indexPage().isOnIndexPage().login(manager.testUser().getEmail(), manager.testUser().getPassword());
			if (manager.isFlirt())
			{
				page().searchPage().closeMobileNumberPopUp();
			}
			page().searchPage().isOnSearchPage();

		}
		catch (Exception p_ex)
		{
			log().errorAndScreen("Registration test error" + p_ex.toString());
		}

		// Verifying result
		test().forErrors();
	}
}
